import request from '@/utils/request'

const api = '/phm/base/zhanqu'

export default {
  fetchallList() {
    return request({
      url: `${api}/weblistall`,
      method: 'get'
    })
  },
  fetchList(query) {
    return request({
      url: `${api}/getZhanqu`,
      method: 'get',
      params: query
    })
  },
  // 执行新增和修改
  update(id, pojo) {
    if (id === null || id === '') {
      return this.save(pojo)
    } else {
      pojo.zqid = id
      return request({
        url: `${api}/update`,
        method: 'post',
        data: pojo
      })
    }
  },
  save(pojo) {
    return request({
      url: `${api}/add`,
      method: 'post',
      data: pojo
    })
  },
  findById(id) {
    return request({
      url: `${api}/find/` + id,
      method: 'get'
    })
  },
  deleteByIds(ids) {
    return request({
      url: `${api}/delete`,
      method: 'delete',
      data: ids
    })
  }
}